package com.ydd.controller.admin;

import com.ydd.dto.SysMenuDTO;
import com.ydd.result.Result;
import com.ydd.service.ISysMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sys_menu")
@Api(tags = "系统设置相关接口")
public class SysMenuController {

    @Autowired
    private ISysMenuService menuService;
    @ApiOperation("菜单修改")
    @PostMapping("/update")
    public Result update(@RequestBody SysMenuDTO dto){
       return menuService.updateMenu(dto);
    }

    @ApiOperation("菜单删除")
    @GetMapping("/del")
    public Result del(String id){
        return menuService.del(id);
    }



    @ApiOperation("所有菜单")
    @GetMapping("/allData")
    public Result allData(){
        return menuService.allData();
    }


    @ApiOperation("菜单详情")
    @GetMapping("/rowInfo")
    public Result rowInfo(Long id){
        return menuService.rowInfo(id);
    }

    @ApiOperation("菜单添加")
    @PostMapping("/add")
    public Result add(@RequestBody SysMenuDTO dto){
        return menuService.add(dto);
    }

}
